<?php
require_once "../config.php";
require_once SESSION_INCLUDE;
require_once GALLERY_INCLUDE;
require_once PHOTO_INCLUDE;

session_start();

	$db = get_session_db($db_config);

	if(!user_is_logged($db))
	{
		header("Location:http://".LOGIN_FILE);
		exit();
	}
	
	$user = get_session_user();
	
	$gallery_titles = get_gallery_option_list($db, $user->get('user_id'));
	
?>

<div style="width: 100%;position:absolute;">
	<form action='../scripts/upload_photo.php' method='post' enctype="multipart/form-data" id="upload_form" >
		<input type="hidden" name="select_gallery" value="" id="select_gallery"/>
		<!--p>Seleziona la Galleria:<br />
		<select id='select_gallery' name='select_gallery'>
			<?php echo $gallery_titles; ?>
			<option value="null">- - - - - -</option>
			<option value=0 id="create_new_gallery">Nuova Galleria</option>
		</select></p-->
		<div class="file_selector" id="list" style="display:none;">
			<p>File scelto[i]:</p>
			<div id="fileList"/>
		</div>
		<div class="file_selector" id="pic_selector">
			<p>Scegli un file:</p>
			<input type='file' id='pic' class="multi accept-gif|jpg|png max-1" name='pic' />
			<input type="hidden" id="pic_controller" value="false" name="pic_controller"/>
			<img src="images/icon-arrow_left.png" class="error" style="display:none;position: relative; left:110px; top: 2px;" />
		</div>
		
		<div class="file_selector" id="title_selector">
			<p>Titolo della foto:</p>
			<input type='text' id='photo_title' name='photo_title' style="width: 200px;"/>
			<img src="images/icon-arrow_left.png" class="error" style="display:none;position: relative; left:10px; top: 2px;" />
		</div>
		
		<div class="file_selector">
			<p>Descrizione:</p>
			<textarea id='photo_description' name='photo_description'></textarea>
		</div>
		
		<div class="file_selector" style="display: block; margin-top: 120px;">
			<input type='submit' value='Upload' style="width: auto;"/>
			<input type="button" value="Annulla" id="undo_btn" style="width: auto;"/>
		</div>
		
		
	</form>
</div>